package offer.nowcoder.queue_stack;

import java.util.Stack;

/**
 * @author DengYuan2
 * @create 2021-02-15 21:11
 */
public class n_30 {
    public static void main(String[] args) {
        n_30 n = new n_30();
        n.push(2);
        n.push(4);
        n.push(6);
    }

    Stack<Integer> stack1 =  new Stack<Integer>();
    Stack<Integer> stack2 =  new Stack<Integer>();

    int min=Integer.MAX_VALUE;
    public void push(int node) {
        if (node<min){
            min=node;
        }
        stack1.push(node);
        stack2.push(min);
    }

    public void pop() {
        stack1.pop();
        stack2.pop();
        min = stack2.peek();
    }

    public int top() {
        return stack1.peek();
    }

    public int min() {
        return min;
    }


}
